package com.petAdoption.manager.controller;

import com.petAdoption.manager.entity.Productcategory;
import com.petAdoption.manager.service.IProductcategoryService;
import com.petAdoption.manager.util.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/productcategory")
public class ProductcategoryController {

    @Resource
    private IProductcategoryService service;

    @Resource
    private Result result;

    @GetMapping("/findAll")
    public Result findAll(){
        List<Productcategory> list = service.findAll();
        if(list!=null && !list.isEmpty()){
            return result.success("查找成功",list);
        }
        return result.fail("查找失败");
    }

}
